<?php
/**
 * ExtScriptManagerBase class file
 *
 * @author TrueSoftware B.V. (The Netherlands)
 * @link http://www.ext4yii.com
 * @copyright Copyright 2007-2010 TrueSoftwareB.V. all rights reserved.
 * @license http://www.ext4yii.com/license/
 *          EVALUATION VERSION - NOT FOR COMMERCIAL USE OR DISTRIBUTION.
 * @version 0.7.2
 */
 
 
abstract class ExtScriptManagerBase extends ExtWidget
{
    private $_resource_class_types = array('ExtScriptFile','ExtCSSFile');
    
    public $scripts = array();
    public $cssfiles = array();

    public function parseNode(ExtHTMLParserNode $node,
        ExtASTWalker $astwalker)
    {
        parent::parseNode($node, $astwalker);
        $resources = $node->findPropertyByName('resources');
        if(!is_null($resources))
        {
            $items=$this->parseNodeWidthTag($resources,
                $astwalker,
                true,
                array('asobject'=>false),
                $this,
                $this->_resource_class_types);
            $resources->shiftUp();
        }
        $node->shiftUp();
    }

    public function setBodyLoadingMask($body)
    {
        $loaderText = trim($this->evaluateValue($this->getLoaderText()));
        if($loaderText=='')
            $loaderText = Ext4Yii::t('ext4yii','Loading, Please wait...');
        else
            $loaderText = trim(
                    $this->evaluateValue(
                            Ext4Yii::t('ext4yii','{loader_text}',array('{loader_text}'=>$this->getLoaderText()
                ))));
        
        $mask = '<div id="loading-mask"></div>
<div id="loading">
  <div id="lmaskind" class="loading-indicator">
    '.$loaderText.'
  </div>
</div>
';
        $body->innertext = $mask . $body->innertext();
    }

    public function renderConfig($asobject=true)
    {
        return null;
    }

    public function createContainer(ExtHTMLParserNode $node)
    {
        $node->shiftUp();
        return null;
    }
}
?>
